/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.vfi.be;

import edu.upn.sigemfi.ope.be.Moneda;
import edu.upn.sigemfi.plt.be.Cuenta;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

/**
 *
 * @author Alex
 */
@Entity
@Table(name = "VFI_DETALLE_TRANSACCION")
@PrimaryKeyJoinColumn(name = "ID_DETALLE_TRANSACCION", referencedColumnName = "ID_TRANSACCION")
@DiscriminatorValue("TRF")
@NamedQueries({@NamedQuery(name = "DetalleTransaccion.findAll", query = "SELECT d FROM DetalleTransaccion d"), @NamedQuery(name = "DetalleTransaccion.findByMonto", query = "SELECT d FROM DetalleTransaccion d WHERE d.monto = :monto"), @NamedQuery(name = "DetalleTransaccion.findByTipoCambioActual", query = "SELECT d FROM DetalleTransaccion d WHERE d.tipoCambioActual = :tipoCambioActual")})
public class DetalleTransaccion
        extends TranFinanciera
        implements Serializable {

    private static final long serialVersionUID = 1L;
    //  @Id
//    @Basic(optional = false)
//    @Column(name = "ID_DETALLE_TRANSACCION", nullable = false)
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//    private Long idDetalleTransaccion;
    @Basic(optional = false)
    @Column(name = "MONTO", nullable = false, precision = 18, scale = 2)
    private BigDecimal monto;
    @Column(name = "TIPO_CAMBIO_ACTUAL", precision = 53)
    private Double tipoCambioActual;
    @JoinColumn(name = "FID_VFI_TIPO_TRANSACCION", referencedColumnName = "ID_TIPO_TRANSACCION", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private TipoTransaccion fidVfiTipoTransaccion;
    @JoinColumn(name = "FID_VFI_TRANSACCION", referencedColumnName = "ID_TRANSACCION", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private TranFinanciera fidVfiTransaccion;
    @OneToMany(mappedBy = "fidVfiDetalleTransaccion", fetch = FetchType.LAZY)
    private List<DetalleCaja> detalleCajaList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "detalleTransaccion", fetch = FetchType.LAZY)
    private LavadoActivos lavadoActivos;
    @JoinColumn(name = "FID_OPE_MONEDA", referencedColumnName = "ID_MONEDA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Moneda fidOpeMoneda;
    @JoinColumn(name = "FID_PLT_CTA_DESTINO", referencedColumnName = "ID_CUENTA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Cuenta fidPltCuentaDestino;

    @Basic(optional = false)
    @Column(name = "ESTADO", nullable = true)
    private boolean estado;


    
    public DetalleTransaccion() {
    }

//    public DetalleTransaccion(Long idDetalleTransaccion) {
//        this.idDetalleTransaccion = idDetalleTransaccion;
//    }
//
//    public DetalleTransaccion(Long idDetalleTransaccion, BigDecimal monto) {
//        this.idDetalleTransaccion = idDetalleTransaccion;
//        this.monto = monto;
//    }
//
//    public Long getIdDetalleTransaccion() {
//        return idDetalleTransaccion;
//    }
//
//    public void setIdDetalleTransaccion(Long idDetalleTransaccion) {
//        this.idDetalleTransaccion = idDetalleTransaccion;
//    }
    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public Double getTipoCambioActual() {
        return tipoCambioActual;
    }

    public void setTipoCambioActual(Double tipoCambioActual) {
        this.tipoCambioActual = tipoCambioActual;
    }

    public TipoTransaccion getFidVfiTipoTransaccion() {
        return fidVfiTipoTransaccion;
    }

    public void setFidVfiTipoTransaccion(TipoTransaccion fidVfiTipoTransaccion) {
        this.fidVfiTipoTransaccion = fidVfiTipoTransaccion;
    }

    public TranFinanciera getFidVfiTransaccion() {
        return fidVfiTransaccion;
    }

    public void setFidVfiTransaccion(TranFinanciera fidVfiTransaccion) {
        this.fidVfiTransaccion = fidVfiTransaccion;
    }

    public List<DetalleCaja> getDetalleCajaList() {
        return detalleCajaList;
    }

    public void setDetalleCajaList(List<DetalleCaja> detalleCajaList) {
        this.detalleCajaList = detalleCajaList;
    }

    public LavadoActivos getLavadoActivos() {
        return lavadoActivos;
    }

    public void setLavadoActivos(LavadoActivos lavadoActivos) {
        this.lavadoActivos = lavadoActivos;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTransaccion != null ? idTransaccion.hashCode() : 0);
        return hash;
    }

//       @Override
//    public int hashCode() {
//        int hash = 0;
//        hash += (idDetalleTransaccion != null ? idDetalleTransaccion.hashCode() : 0);
//        return hash;
//    }
//    @Override
//    public boolean equals(Object object) {
//        // TODO: Warning - this method won't work in the case the id fields are not set
//        if (!(object instanceof DetalleTransaccion)) {
//            return false;
//        }
//        DetalleTransaccion other = (DetalleTransaccion) object;
//        if ((this.idDetalleTransaccion == null && other.idDetalleTransaccion != null) || (this.idDetalleTransaccion != null && !this.idDetalleTransaccion.equals(other.idDetalleTransaccion))) {
//            return false;
//        }
//        return true;
//    }
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transaccion)) {
            return false;
        }
        Transaccion other = (Transaccion) object;
        if ((this.idTransaccion == null && other.idTransaccion != null) || (this.idTransaccion != null && !this.idTransaccion.equals(other.idTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.DetalleTransaccion[idDetalleTransaccion=" + idTransaccion + "]";
    }

    /**
     * @return the fidOpeMoneda
     */
    public Moneda getFidOpeMoneda() {
        return fidOpeMoneda;
    }

    /**
     * @param fidOpeMoneda the fidOpeMoneda to set
     */
    public void setFidOpeMoneda(Moneda fidOpeMoneda) {
        this.fidOpeMoneda = fidOpeMoneda;
    }

    /**
     * @return the fidPltCuentaDestino
     */
    public Cuenta getFidPltCuentaDestino() {
        return fidPltCuentaDestino;
    }

    /**
     * @param fidPltCuentaDestino the fidPltCuentaDestino to set
     */
    public void setFidPltCuentaDestino(Cuenta fidPltCuentaDestino) {
        this.fidPltCuentaDestino = fidPltCuentaDestino;
    }

    /**
     * @return the estado
     */
    public boolean isEstado() {
        return estado;
    }

    /**
     * @param estado the estado to set
     */
    public void setEstado(boolean estado) {
        this.estado = estado;
    }

    /**
     * @return the fidPltCuentaDestino
     */


    /**
     * @return the fidPltCuenta
     */
    //@Override
//  
}
